import './assets/main.less'
import { createApp } from 'vue'
import { ellipsis } from './directive/index'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

import App from './App.vue'
import router from './router'

const app = createApp(App) // 注册自定义指令
  .directive('ellipsis', ellipsis)

// 引入全局组件
import globalComponent from '@/components/index'
// 遍历注册全局组件
for (const componentItem in globalComponent) {
  app.component(componentItem, globalComponent[componentItem])
}

const pinia = createPinia()
// 使用pinia-plugin-persistedstate插件
pinia.use(piniaPluginPersistedstate)
app.use(pinia)

app.use(router)

app.mount('#app')
